package com.hspedu.newData.LCR;

import com.hspedu.newData.dmsxl.ds.ListNode;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-17 
 * @Version: 1.0
 */

public class LCR142训练计划Ⅳ {

    public ListNode trainningPlan(ListNode l1, ListNode l2) {

        ListNode dummy = new ListNode();

        ListNode temp = dummy;

        while (l1 != null && l2 != null){

            if (l1.val < l2.val){

                temp.next = l1;
                temp = temp.next;
                l1 = l1.next;
            }else{
                temp.next = l2;
                temp = temp.next;
                l2 = l2.next;
            }
        }
        if (l1 == null){
                temp.next = l2;
            }
            if (l2 == null){
                temp.next = l1;
            }

        return dummy.next;
    }
}
